//////////////////////////////////////////////////////////////////////////////////
//
//	DoD Melee Bonus
//		- Version 0.6beta
//		- 08.16.2006
//		- original: FireStorm
//		- updated: diamond-optic
//
//////////////////////////////////////////////////////////////////////////////////
//
// Information:
//
// 	- Gain health for melee kills
//
// CVARs: 
//
//	meleebonus_enabled "1" 			//Turn On(1)/Off(0)
//	meleebonus_givehealth "10"		//health to add for each melee kill
//
// Changelog:
//
//	- unknown date Version 0.5beta
//		FireStorm's version
//
//	- 08.16.2006 Version 0.6beta
//		Reposted plugin
//		Added pcvars
//		Got rid of extra code
//		Added is_user_connected check
//
//////////////////////////////////////////////////////////////////////////////////


#include <amxmodx>
#include <fun>
#include <dodx>

new p_enabled, p_givehealth

public plugin_init()
{
    register_plugin("DoD Melee Bonus","0.6beta","AMXX DoD Team")
    
    register_cvar("dod_meleebonus_stats", "0.6beta", FCVAR_SERVER|FCVAR_SPONLY)
    
    p_enabled = register_cvar("meleebonus_enabled","1")
    p_givehealth = register_cvar("meleebonus_givehealth","10")
    
    register_statsfwd(XMF_DEATH)
}

public client_death(killer,victim,wpnindex,hitplace,TK)
{
   if(get_pcvar_num(p_enabled) == 1 && is_user_connected(killer))
	{
	if(TK == 0)
		{
		new killername[32]
		get_user_name(killer,killername,31)
		new oldhealth = get_user_health(killer)
		new addition = get_pcvar_num(p_givehealth)

		if(wpnindex == DODW_GARAND_BUTT || wpnindex == DODW_K43_BUTT || wpnindex == DODW_KAR_BAYONET || wpnindex == DODW_AMERKNIFE || wpnindex == DODW_BRITKNIFE || wpnindex == DODW_GERKNIFE || wpnindex == DODW_SPADE)
			{
			set_user_health(killer,(oldhealth+addition))
			client_print(0,print_chat,"[AMXX] %s received additional %dhp for a melee kill!",killername,addition)
			set_hudmessage(36, 39, 192, -1.0, 0.9, 0, 6.0, 4.0, 0.1, 0.2, 4)
			show_hudmessage(killer,"+%dhp",addition)
			}
		}
	}
   return PLUGIN_HANDLED
}
